package stool.command;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author Felix YF Dong
 * @Date 2021/5/13
 */
public class Waiter {

    private List<Command> commands = new ArrayList<>();

    public void setOrder(Command command) {
        if (command instanceof BakeChickenWingCommand) {
            System.out.println("non chicken wing");
        } else {
            commands.add(command);
            System.out.println("add order");
        }
    }

    public void cancel(Command command) {

        commands.remove(command);
        System.out.println("cancel order");
    }

    public void notifyExecute() {

        commands.forEach(Command::excute);

    }
}
